package com.example.myapplication;

import androidx.appcompat.app.AppCompatActivity;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.text.Editable;
import android.util.Log;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

public class SecondActivity extends AppCompatActivity {

    private TextView tvUser;
    private TextView tvSecondPwd;
    private TextView tvAge;
    private TextView tvTrueName;
    private Button btnFinish;
    private EditText etUser;
    private EditText etSecondpwd;
    private EditText etAge;
    private EditText etTrueName;



    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_second);


        tvUser = (TextView) findViewById(R.id.tv_user);
        tvSecondPwd = (TextView) findViewById(R.id.tv_second_pwd);
        tvAge = (TextView) findViewById(R.id.tv_age);
        tvTrueName = (TextView) findViewById(R.id.tv_trueName);
        btnFinish = (Button) findViewById(R.id.btn_finish);

        etUser = (EditText) findViewById(R.id.et_user);
        etSecondpwd = (EditText) findViewById(R.id.et_second_pwd);
        etAge = (EditText) findViewById(R.id.et_age);
        etTrueName = (EditText) findViewById(R.id.et_trueName);

        btnFinish.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                Intent it = new Intent();
                it.putExtra("user",etUser.getText().toString());
                it.putExtra("pwd", etSecondpwd.getText().toString());
                it.putExtra("age",etAge.getText().toString());
                it.putExtra("trueName",etTrueName.getText().toString());
                setResult(Activity.RESULT_OK,it);
                finish();
            }
        });
    }
}